package com.huangcy.gulimall.thirdpart.controller;

import com.huangcy.common.utils.R;
import com.huangcy.gulimall.thirdpart.component.SmsComponent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: gulimall
 * @description:
 * @author: huangcy
 * @create: 2022-08-26 11:26
 **/
@RestController
@RequestMapping("/sms")
public class SmsSendController {

    @Autowired
    SmsComponent smsComponent;

    /**
     * @param phone
     * @param code
     * @return com.huangcy.common.utils.R
     * @MethodName sendCode
     * @Description 提供给别的服务调用
     * @Author huangcy
     * @Date 2022/8/26 11:27
     */
    @ResponseBody
    @PostMapping("/sendCode")
    public R sendCode(@RequestParam("phone") String phone, @RequestParam("code") String code) {
        smsComponent.sendSmsCode(phone, code);
        return R.ok();
    }
}
